package com.ruoyi.web.controller.school;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.school.domain.PacFaculties;
import com.ruoyi.school.domain.PacFaculties;
import com.ruoyi.school.domain.Student;
import com.ruoyi.school.service.PacFacultiesService;
import com.ruoyi.school.service.StudentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@Api("院系相关接口")
@RestController
@RequestMapping("/school/faculties")
public class PacFacultiesController extends BaseController {
    @Resource
    private PacFacultiesService pacFacultiesService;

    @ApiOperation("所有院系接口")
    @GetMapping("/all")
    public AjaxResult all(PacFaculties pacFaculties) {
        List<PacFaculties> pacFacultiesList = pacFacultiesService.all(pacFaculties);
        return success(pacFacultiesList);
    }

    @GetMapping("/list")
    public TableDataInfo list(PacFaculties pacCollege) {
        startPage();
        List<PacFaculties> list = pacFacultiesService.getList(pacCollege);
        return getDataTable(list);
    }

    
    @GetMapping("/details")
    public AjaxResult details(PacFaculties pacCollege) {
        PacFaculties details = pacFacultiesService.getDetails(pacCollege);
        return success(details);
    }

    @Log(title = "学院", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody PacFaculties pacCollege) {
        boolean add = pacFacultiesService.add(pacCollege);
        return success(add);
    }

    @Log(title = "学院", businessType = BusinessType.UPDATE)
    @PostMapping("/update")
    public AjaxResult update(@RequestBody PacFaculties pacCollege) {
        boolean update = pacFacultiesService.edit(pacCollege);
        return success(update);
    }

    @Log(title = "学院", businessType = BusinessType.DELETE)
    @DeleteMapping("/delete")
    public AjaxResult delete(PacFaculties pacCollege) {
        boolean delete = pacFacultiesService.delete(pacCollege);
        return success(delete);
    }
}
